More liberally use QStringLiteral for Qt 5.9.
authorRobert Lipe <robertlipe@gpsbabel.org>
Tue, 5 Sep 2017 04:08:36 +0000 (23:08 -0500)
committerRobert Lipe <robertlipe@gpsbabel.org>
Tue, 5 Sep 2017 04:08:36 +0000 (23:08 -0500)
gpx.cc
magproto.cc
unicsv.cc

diff --git a/gpx.cc b/gpx.cc
index 3b3b963c33e9e52e7d68408b32ff02c14cdcba9c..36701e52aab53b884ca40aa795065be34c029108 100644 (file)
--- a/gpx.cc
+++ b/gpx.cc
@@ -494,7 +494,7 @@ tag_cache_desc(const QXmlStreamAttributes& attr)
 {
   cache_descr_is_html = 0;
   if (attr.hasAttribute("html")) {
-    if (attr.value("html").toString().compare("True") == 0) {
+    if (attr.value("html").toString() == QStringLiteral("True")) {
       cache_descr_is_html = 1;
     }
   }
@@ -509,16 +509,16 @@ tag_gs_cache(const QXmlStreamAttributes& attr)
     gc_data->id = attr.value("id").toString().toInt();
   }
   if (attr.hasAttribute("available")) {
-    if (attr.value("available").toString().compare("True", Qt::CaseInsensitive) == 0) {
+    if (attr.value("available").toString().compare(QStringLiteral("True"), Qt::CaseInsensitive) == 0) {
       gc_data->is_available = status_true;
-    } else if (attr.value("available").toString().compare("False", Qt::CaseInsensitive) == 0) {
+    } else if (attr.value("available").toString().compare(QStringLiteral("False"), Qt::CaseInsensitive) == 0) {
       gc_data->is_available = status_false;
     }
   }
   if (attr.hasAttribute("archived")) {
-    if (attr.value("archived").toString().compare("True", Qt::CaseInsensitive) == 0) {
+    if (attr.value("archived").toString().compare(QStringLiteral("True"), Qt::CaseInsensitive) == 0) {
       gc_data->is_archived = status_true;
-    } else if (attr.value("archived").toString().compare("False", Qt::CaseInsensitive) == 0) {
+    } else if (attr.value("archived").toString().compare(QStringLiteral("False"), Qt::CaseInsensitive) == 0) {
       gc_data->is_archived = status_false;
     }
   }
@@ -972,7 +972,7 @@ gpx_end(const QString& el)
      * last date we saw in this log.
      */
   case tt_cache_log_type:
-    if ((cdatastr.compare("Found it") == 0) &&
+    if ((cdatastr.compare(QStringLiteral("Found it")) == 0) &&
         (0 == wpt_tmp->gc_data->last_found.toTime_t())) {
       wpt_tmp->AllocGCData()->last_found = gc_log_date;
     }
@@ -1423,7 +1423,7 @@ fprint_xml_chain(xml_tag* tag, const Waypoint* wpt)
         fprint_xml_chain(tag->child, wpt);
       }
       if (wpt && wpt->gc_data->exported.isValid() &&
-          tag->tagname.compare("groundspeak:cache") == 0) {
+          tag->tagname.compare(QStringLiteral("groundspeak:cache")) == 0) {
         writer->writeTextElement("time",
                                  wpt->gc_data->exported.toPrettyString());
       }
index 7c82e9fb2252c423a700e52cfbd90a592a7c11be..0deb7f33605dfc53132031626a05caceca9a6933 100644 (file)
@@ -819,11 +819,11 @@ mag_rd_init_common(const QString& portname)
    */
   QString exten = QFileInfo(curfname).suffix();
   if (exten.length() > 0) {
-    if (0 == exten.compare("upt", Qt::CaseInsensitive)) {
+    if (0 == exten.compare(QStringLiteral("upt"), Qt::CaseInsensitive)) {
       extension_hint = WPTDATAMASK;
-    } else if (0 == exten.compare("log", Qt::CaseInsensitive)) {
+    } else if (0 == exten.compare(QStringLiteral("log"), Qt::CaseInsensitive)) {
       extension_hint = TRKDATAMASK;
-    } else if (0 == exten.compare("rte", Qt::CaseInsensitive)) {
+    } else if (0 == exten.compare(QStringLiteral("rte"), Qt::CaseInsensitive)) {
       extension_hint = RTEDATAMASK;
     }
   }
index 4a7d78eddf97486dc222603147247f3d802bb313..6312e9d27b11d3a18fdac0fca1fe10845ef780ab 100644 (file)
--- a/unicsv.cc
+++ b/unicsv.cc
@@ -430,13 +430,13 @@ unicsv_parse_time(const QString& str, int* msec, time_t* date)
 static status_type
 unicsv_parse_status(const QString& str)
 {
-  if (str.compare("true", Qt::CaseInsensitive) == 0 ||
-      str.compare("yes", Qt::CaseInsensitive) == 0 ||
+  if (str.compare(QStringLiteral("true"), Qt::CaseInsensitive) == 0 ||
+      str.compare(QStringLiteral("yes"), Qt::CaseInsensitive) == 0 ||
       str == "1") {
     return status_true;
   }
-  if (str.compare("false", Qt::CaseInsensitive) == 0 ||
-      str.compare("no", Qt::CaseInsensitive) == 0 ||
+  if (str.compare(QStringLiteral("false"), Qt::CaseInsensitive) == 0 ||
+      str.compare(QStringLiteral("no"), Qt::CaseInsensitive) == 0 ||
       str == "0") {
     return status_false;
   }